package com.powervision.mvvmdemo.ui.viewmodel

import com.powervision.base.base.BaseViewModel
import com.powervision.http.observer.StateLiveData
import com.powervision.mvvmdemo.ui.model.ArticleListModel
import com.powervision.mvvmdemo.ui.repository.WxArticleSearchListRepository

/**
 * @auth: njb
 * @date: 2021/12/23 9:51
 * @desc: 描述
 */
class WxArticleSearchListViewModel : BaseViewModel() {
    private val mWxArticleSearchListRepository by lazy { WxArticleSearchListRepository() }
    val mWxArticleSearchLiveData = StateLiveData<ArticleListModel>()

    fun wxArticleSearchList(page: Int, id: String, keyWord: String) {
        launchWithLoading(
            requestBlock = {
                mWxArticleSearchListRepository.wxArticleSearchList(page, id, keyWord)
            }, resultCallback = {
                mWxArticleSearchLiveData.value = it
            })
    }
}